package com.csthink.web.interfaces;

import com.csthink.mysql.entity.WebPermission;
import com.csthink.web.application.service.WebPermissionService;
import io.swagger.annotations.Api;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;

/**
 * @author <a href="mailto:security.2009@live.cn">Mars</a>
 * @since 2023-09-11
 */
@Api(tags = "Test 模块")
@RestController
@RequestMapping(value = "/spring-cache")
public class SpringCacheTestController {

    @Setter(onMethod_ = @Autowired)
    private WebPermissionService webPermissionService;

    @GetMapping("/query")
    public WebPermission query(@Valid @NotEmpty @RequestParam String id) {
        return webPermissionService.getByPermissionId(id);
    }
}
